package com.example.anew.journey.mynewjourney.firstchangelogic.firstChangeHistoricalRecordCardiacDetection.persenter;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.PopupWindow;

import com.example.anew.journey.mynewjourney.R;
import com.example.anew.journey.mynewjourney.firstchangelogic.firstChangeHistoricalRecordCardiacDetection.view.FirstChangeHistoricalRecordCardiacDetectionView;

/**
 * 杭州惟君医疗科技有限公司20
 * Created by 20433 on 2018/3/21
 *
 * @desc 东风山河绿，春已不折柳，繁花看不尽，处处惹人留
 * @desc 佛祖镇楼，bug辟容易
 */

public class FirstChangeHistoricalRecordCardiacDetectionPersenter {

    private FirstChangeHistoricalRecordCardiacDetectionView mFirstChangeHistoricalRecordCardiacDetectionView;
    private PopupWindow mPopWindowrecordCardiacDetection;

    public FirstChangeHistoricalRecordCardiacDetectionPersenter(FirstChangeHistoricalRecordCardiacDetectionView iFirstChangeHistoricalRecordCardiacDetectionView) {
        this.mFirstChangeHistoricalRecordCardiacDetectionView = iFirstChangeHistoricalRecordCardiacDetectionView;
    }
    // 弹出分享弹框
    public void  onClickeShared(Context mcontext){
        View contentView = LayoutInflater.from(mcontext).inflate(R.layout.historcal_record_cardiac_detection_pupo, null);
        mPopWindowrecordCardiacDetection = new PopupWindow(contentView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, true);
        mPopWindowrecordCardiacDetection.setContentView(contentView);
        mFirstChangeHistoricalRecordCardiacDetectionView.findPupoView(contentView);
        //显示PopupWindow
        mPopWindowrecordCardiacDetection.setAnimationStyle(R.style.mypopwindow_anim_style);
        View rootview = LayoutInflater.from(mcontext).inflate(R.layout.activity_first_change_historcal_record_cardiac_detection, null);
        mPopWindowrecordCardiacDetection.showAtLocation(rootview, Gravity.BOTTOM, 0, 0);
    }
    //设置进度
    public void setMyProgess(int progess){
        mFirstChangeHistoricalRecordCardiacDetectionView.setMyProgess(progess);
    }
    // 设置分析报告
    public void setAnalysisReport(String str){
        mFirstChangeHistoricalRecordCardiacDetectionView.setAnalysisReport(str);
    }
    //设置建议
    public  void setAdvice(String str){
        mFirstChangeHistoricalRecordCardiacDetectionView.setAdvice(str);
    }
    //点击 分享微信
    public void  onClickShareWeixin(){
        onClicksharedCancel();
    }
    //点击 分享朋友圈
    public void  onClickSharePengyouquan(){
        onClicksharedCancel();
    }
    //点击 分享QQ
    public void  onClickShareQQ(){
        onClicksharedCancel();
    }
    //点击 分享新浪
    public void  onClickShareWeibo(){
        onClicksharedCancel();
    }
    //分享 取消
    public void  onClicksharedCancel(){
        //mFirstChangeHistoricalRecordCardiacDetectionView.sharedCancel();
        mPopWindowrecordCardiacDetection.dismiss();
    }

}
